﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace СityDelivery
{
	public partial class ShowPathForm : Form
	{
		public ShowPathForm()
		{
			InitializeComponent();
			for (int index = 0; index < Data.pathList.Count; index++)
			{
				int minutesFrom, hoursTo, minutesTo;
				int hoursFrom = Data.pathList[index].TimeFrom / 60;

				String minutesStrFrom = "";
				String minutesStrTo = "";
				minutesFrom = Data.pathList[index].TimeFrom % 60;
				hoursTo = Data.pathList[index].TimeTo / 60;
				minutesTo = Data.pathList[index].TimeTo % 60;
				if (minutesFrom >= 0 && minutesFrom <= 9)
				{
					minutesStrFrom = "0" + minutesFrom.ToString();
				}
				else
				{
					minutesStrFrom = minutesFrom.ToString();
				}
				if (minutesTo >= 0 && minutesTo <= 9)
				{
					minutesStrTo = "0" + minutesTo.ToString();
				}
				else
				{
					minutesStrTo = minutesTo.ToString();
				}

				String timeText = hoursFrom + ":" + minutesStrFrom + "-" + hoursTo + ":" + minutesStrTo;
				pathGrid.Rows.Add(timeText,
				Data.pathList[index].PlaceFrom, Data.pathList[index].PlaceTo, Data.pathList[index].Distance);


			}
		}

		private void button1_Click(object sender, EventArgs e)
		{
			this.Close();
		}
	}
}
